import View from "./index.vue";
import { withInstall } from "@pureadmin/utils";
import type { ConfigItem } from "./types/index.d";
import { useFormHook } from "../FormView/lib/useFormData";
import type { FormInstance } from "element-plus";

export const FormView = withInstall(View);
export interface FormConfigItem extends ConfigItem {}

/**
 * @description 处理表单数据hook
 * @param {ConfigItem} item
 * @param {Record<string, any>} data
 */
export const useFormData = useFormHook;

/** 导出组件实例类型 */
export interface FormViewInstance extends InstanceType<typeof View> {
  $refs: {
    formRef: FormInstance;
  };
}

export default FormView;
